
//---------------------------------------------------------------------------
#ifndef PG1_RENDERER_H
#define PG1_RENDERER_H
//---------------------------------------------------------------------------
#include "pg1_api.h"
//---------------------------------------------------------------------------
#include "rendering/pg1_rendertypes.h"
#include "math/pg1_math.h"
//---------------------------------------------------------------------------
#include <string>
#include <vector>
//---------------------------------------------------------------------------
struct IDirect3D9;
struct IDirect3DDevice9;
//---------------------------------------------------------------------------
namespace pg1
{
//---------------------------------------------------------------------------
class VertexBuffer;
struct ColorVertex;
struct TexCoordVertex;
//---------------------------------------------------------------------------
class PG1_API Renderer
{
// initialization
public:
	Renderer ();
	~Renderer ();

	bool init (HWND hWnd);


// rendering
public:
	void beginFrame ();
	void endFrame ();

	void draw (ColorVertex* apkVertices, Primitive ePrimitive, size_t uiVertexCount);
	void draw (TexCoordVertex* apkVertices, Primitive ePrimitive, size_t uiVertexCount);

private:
	VertexBuffer* m_pkColorVB;
	VertexBuffer* m_pkTexCoordVB;
	

// matrix handling
public:
	void setMatrix (MatrixType eMatrixType, const Matrix& rkMatrix);


// texture handling
public:
	const Texture loadTexture (const std::string& rkFilename, int iColorKey);
	void setCurrentTexture (const Texture& rkTexture);

private:
	std::vector<Texture> m_akTextures;


// DirectX stuff
private:
	IDirect3D9* m_pkD3D;
	IDirect3DDevice9* m_pkDevice;
};
//---------------------------------------------------------------------------
#include "pg1_renderer.inl"
//---------------------------------------------------------------------------
} // end namespace
//---------------------------------------------------------------------------
#endif // PG1_RENDERER_H
//---------------------------------------------------------------------------
